package br.com.tcc.core;

import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;

public class PrincipalApplet extends Applet {

	private static final long serialVersionUID = 1L;
	private static final int PWIDTH = 640;
	private static final int PHEIGHT = 400;

	Controller controller;
	Graphics bufferGraphics;
	Image offscreen;

	public PrincipalApplet() {
		controller = new Controller(this);
	}

	public void init() {
		//setPreferredSize(new Dimension(PWIDTH, PHEIGHT));
		setSize(PWIDTH, PHEIGHT);
		setLayout(new BorderLayout());
		setFocusable(true);
		requestFocus();
	}

	public void start() {
//		System.out.println("Startando..");
		controller.startForm();
	}

	public void stop() {
//		System.out.println("Parando..");
		controller.stop();
	}

	public void destroy() {
//		System.out.println("Destruindo..");
		controller.destroy();
	}

	public void removeScreen(Component component) {
		remove(component);
	}

	public void showScreen(Component component) {
		add("Center", component);
	}
	
	public void deleteController(){
		controller = null;
		controller = new Controller(this);
		System.out.println("CONTROLLER DELETADO");
		controller.startForm();
	}

}
